package entity.lemming;

import java.awt.Rectangle;

import entity.Entity;
import entity.terrain.Terrain;

import level.Level;

/**
 * A Lemming of infinite energy that continuously makes progress in the x-plane.
 * 
 * @author Neil Cowzer
 */
public class Walker extends Lemming {
	
	/**
	 * Create a new Walker.
	 * 
	 * @param level The level which the Walker exist in.
	 * @param x The x-coordinate of the Walker.
	 * @param y The y-coordinate of the Walker.
	 */
	/*@ requires 0 <= x && 0 <= y;
		assignable speed_X && speed_Y && energy;
		ensures speed_X != 0 && energy == 100;
	 */
	public Walker(int x,int y) {
		// Hardcode Image location
		super("resource/graphics/lemming/walker/walker1.gif", x, y);
		speed_X = 1;
		speed_Y = 0;
		energy = 100;
	}
	
	/** Request that this lemming perform the appropiate action/movement. */
	/*@ ensures x != \old(x) + speed_X &&
				energy == 100;
	 */
	public void move(){
		// to be fully implemented
		x= x+speed_X;
		update();
	}
	
	/**
	 * Check to see if a Lemming collides with another entity
	 * 
	 * @param other another entity eg. terrain, blocker.
	 * @return true if collision occurs.
	 */
	public /*@ pure @*/ boolean collision(Entity other){
		Rectangle me = getBounds();
		if (other instanceof Blocker || other instanceof Terrain){
			if (me.intersects(other.getBounds())){
				//return true;
			}
		}
		return false;
	}
}
